{template 'header'}
<link type="text/css" rel="stylesheet" href="../addons/tiger_jifenbao/css/base.css" />
<link type="text/css" rel="stylesheet" href="../addons/tiger_jifenbao/css/style1.css?v=203" />
<link type="text/css" rel="stylesheet" href="../addons/tiger_jifenbao/template/js/sweetalert.css"/>
<script type="text/javascript" src="../addons/tiger_jifenbao/template/js/sweetalert.min.js"></script>


<title>兑奖信息</title>
	<section class="reserve">
    	<!--content-->
        <section class="reserve_content">
        	<!--title-->
            <p class="reserve_title"><span>请认真填写收件人信息,客服人员将会与您联系</span></p>
            <!--tielt end-->
            <!--details-->
            <section class="reserve_details">
			{php foreach(explode("-",$goods_info['title']) as $v) echo "<p>" . $v . "</p>"; }
            </section>
            <!--details end-->
			<!--data-->
			<section class="reserve_data">
			
        {if $goods_info['type'] == 1}
                <section class="data_box">
				<label class="data_box_l">真实姓名</label>
				<span class="data_box_r"><input type="text" name="realname" id="realname" value="{$profile['realname']}" placeholder="请输入您的真实姓名" class="txt" /></span>
				</section>
                <section class="data_box">
                    	<label class="data_box_l">联系电话</label>
						<span class="data_box_r"><input name="mobile" id="mobile" type="tel" value="{$profile['mobile']}" placeholder="请输入您的手机" class="txt" /></span>
				</section>
                 <section class="data_box">
                    	<label class="data_box_l">邮寄地址</label>
						<span class="data_box_r"><input name="residedist" id="residedist" type="text" value="{$profile['residedist']}" placeholder="请输入您的邮寄地址" class="txt" /></span>
				</section>
        {else if $goods_info['type']== 2}
                <section class="data_box">
                    	<label class="data_box_l">手机号码</label>
						<span class="data_box_r"><input name="mobile" type="tel" id="mobile" value="{$profile['mobile']}" placeholder="请输入您的手机" class="txt" /></span>
				</section>
        {else if $goods_info['type'] == 0}
           <section class="data_box">
                    	<label class="data_box_l">支付宝</label>
						<span class="data_box_r"><input name="alipay" id="alipay" type="text" value="{$profile['alipay']}" placeholder="请输入您的支付宝" class="txt" /></span>
		   </section>
        {/if}
                  <section class="data_box">
                    	<label class="data_box_l">备注</label>
						<span class="data_box_r"><input name="note" id="note" type="text" value="" placeholder="如有，请填写" class="txt" /></span>
				</section>

                    <!--btn-->

                    <section class="reserve_btn_box">
                       <div style="display:none" id="dis">
                        <input type="submit" value="提交中，请稍后…… " class="btn btn-danger" style="width:100%;margin-bottom:6px;"/>
                       </div>
                        <input type="submit" id="submit" value="提交兑换" class="btn btn-success" style="width:100%" />
                    </section>
                    <!--btn end-->
					<input type="hidden" name="token" value="{$_W['token']}" />
                <!--/form-->
            </section>
            <!--data end-->
        </section>
        <!--content end-->
		</section>

<script type="text/javascript">   
$(document).ready(function(){ 
        


      $("#submit").click(function(){
        

        $("#dis").css("display", "block");

        $.ajax({
          url:"{php echo $this->createMobileUrl('Goodpost')}",
          type:'post',
          data:{
             goods_id:"{$goods_id}",
             type:"{$goods_info['type']}",
             weid:"{$_W['weid']}",
             realname:$('#realname').val(),
             memberid:"{$memberid}",
             mobile:$('#mobile').val(),
             residedist:$('#residedist').val(),
             alipay:$('#alipay').val(),
             note:$('#note').val(),             
          },
          dataType:"json", 
          success:function(data){
            if(data.success==true){
                $("#dis").css("display", "none");
                    swal({
                        title: "兑换成功",
                        text: data.msg,
                        type: "success",
                        showCancelButton: false,
                        closeOnConfirm: false,
                        confirmButtonText: "查看已兑换奖品",
                        confirmButtonColor: "#ec6c62"
                    }, function() {                      
                        location.href ="{php echo $this->createMobileUrl('request')}";                      
                    });

            }else{
              swal({title: "尊敬的粉丝",   
        			  text: "很抱歉兑换失败--" + data.msg +　" ",  
        		      type: "warning",    
        		      confirmButtonColor: "#DD6B55",  
        			  confirmButtonText: "确定",   closeOnConfirm: false }, 
        			  function(){   
        			  location.reload(); 
        		    });
            }
            
          }

        });

        
      });
});
</script>

<div style="width:100%; line-height:30px; text-align:center;font-size:12px;">{$_W['account']['name']}</div>
